package ru.aslanov.schedule.client;

import com.smartgwt.client.widgets.Button;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.VLayout;
import ru.aslanov.schedule.client.util.MyAsyncCallback;

/**
 * Created by IntelliJ IDEA.
 * Created: Mar 9, 2010 1:20:13 PM
 *
 * @author Sergey Aslanov
 */
public class AdminPanel extends VLayout {
    public AdminPanel() {
        super(10);

        final Button adminAction = new Button("Sync groups days");
        adminAction.setAutoFit(true);
        adminAction.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                ScheduleServices.App.getInstance().syncGroupDays(new MyAsyncCallback<Void>(adminAction));
            }
        });
        addMember(adminAction);

        final Button clearCache = new Button("Clear memCache");
        clearCache.setAutoFit(true);
        clearCache.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                ScheduleServices.App.getInstance().clearMemCache(new MyAsyncCallback<Void>(clearCache));
            }
        });
        addMember(clearCache);
    }
}
